<template>
    <van-search v-model="value" show-action label="地址" placeholder="请输入搜索关键词" @search="onSearch">
        <template #action>
            <div @click="onClickButton">搜索</div>
        </template>
    </van-search>

    <van-tabs v-model:active="active">
        <van-tab title="奶粉"></van-tab>
        <van-tab title="纸品尿裤"></van-tab>
        <van-tab title="营养辅食"></van-tab>
        <van-tab title="玩具"></van-tab>
        <van-tab title="母婴用品"></van-tab>
    </van-tabs>

    <van-grid>
        <van-grid-item icon="photo-o" text="领券中心" />
        <van-grid-item icon="photo-o" text="新客领福利" />
        <van-grid-item icon="photo-o" text="超级会员" />
        <van-grid-item icon="photo-o" text="积分商城" />
    </van-grid>
    <van-pull-refresh v-model="loading" @refresh="onRefresh">
        <div v-for="item in searchApiData">
            <router-link :to="'/xq/' + item.goods_id">
                <van-card :price="item.goods_price" :title="item.goods_name"
                    :thumb="item.goods_big_logo ? item.goods_big_logo : 'https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg'" />
            </router-link>

        </div>

    </van-pull-refresh>




</template>


<script setup>
import { searchApi } from '@/api/api'
import { ref } from 'vue'
const searchApiData = ref([])
searchApi().then(res => {
    console.log('列表数据', res);
    searchApiData.value = res.data.message.goods
})
import { showToast } from 'vant';
const count = ref(0);
const loading = ref(false);
const onRefresh = () => {
    setTimeout(() => {
        showToast('刷新成功');
        loading.value = false;
        count.value++;
    }, 1000);
};
</script>

<style lang="scss" scoped></style>